﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpiderStudy.Utils.EditHelper
{

    namespace CatUtils.Utils.EditHelper
    {
        internal class HtmlCodeCreate
        {
            /// <summary>
            /// 创建基础的HTML标签，返回<xx>{0}</xx>
            /// </summary>
            /// <param name="LableName"></param>
            /// <returns></returns>
            public string BasicsCode(string LableName)
            {
                return BasicsCode(LableName, "");
            }
            /// <summary>
            /// 基础标签创建，请参考：<{0} {1}>{2}</{0}>
            /// </summary>
            /// <param name="LableName">标签名字</param>
            /// <param name="Extend">扩展内容</param>
            /// <returns></returns>
            public string BasicsCode(string LableName, string Extend)
            {

                return string.Format("<{0} {1}>{2}</{0}>", LableName, Extend, "{0}");
            }
            /// <summary>
            /// 创建属性内容
            /// </summary>
            /// <param name="Lable"></param>
            /// <param name="Content"></param>
            /// <returns></returns>
            public string AttributeCode(string Lable, string Content)
            {

                return string.Format(" {0}=\"{1}\" ", Lable, Content);
            }

            /// <summary>
            /// 创建IMG标签
            /// </summary>
            /// <param name="Imgsrc"></param>
            /// <returns></returns>
            public string LableImg(string Imgsrc)
            {

                return string.Format(BasicsCode("img", AttributeCode("src", Imgsrc)).Replace("{0}", ""), "");
            }
            /// <summary>
            /// 创建IMG标签
            /// </summary>
            /// <param name="Imgsrc"></param>
            /// <param name="ClassName"></param>
            /// <returns></returns>
            public string LableImg(string Imgsrc, string ClassName)
            {

                return string.Format(BasicsCode("img", AttributeCode("src", Imgsrc) + AttributeCode("class", ClassName)), "");
            }
            /// <summary>
            /// 创建P标签
            /// </summary>
            /// <param name="Content"></param>
            /// <returns></returns>
            public string LableP(string Content)
            {
                return string.Format(BasicsCode("p"), Content);
            }

            /// <summary>
            /// 创建P标签
            /// </summary>
            /// <param name="Content"></param>
            /// <param name="Class"></param>
            /// <returns></returns>
            public string LableP(string Content, string ClassName)
            {
                return string.Format(BasicsCode("p", AttributeCode("class", ClassName)), Content);
            }
            /// <summary>
            /// 创建Div标签
            /// </summary>
            /// <param name="Content"></param>
            /// <returns></returns>
            public string LableDiv(string Content)
            {
                return string.Format(BasicsCode("div"), Content);
            }

            /// <summary>
            /// 创建Div标签
            /// </summary>
            /// <param name="Content"></param>
            /// <param name="Class"></param>
            /// <returns></returns>
            public string LableDiv(string Content, string ClassName)
            {
                return string.Format(BasicsCode("div", AttributeCode("class", ClassName)), Content);
            }
            /// <summary>
            /// 创建A标签
            /// </summary>
            /// <param name="Content"></param>
            /// <returns></returns>
            public string LableA(string Content)
            {
                return string.Format(BasicsCode("a"), Content);
            }

            /// <summary>
            /// 创建A标签
            /// </summary>
            /// <param name="Content"></param>
            /// <param name="Class"></param>
            /// <returns></returns>
            public string LableA(string Content, string ClassName)
            {
                return string.Format(BasicsCode("a", AttributeCode("class", ClassName)), Content);
            }
            /// <summary>
            /// 创建A标签
            /// </summary>
            /// <param name="Content"></param>
            /// <param name="Class"></param>
            /// <returns></returns>
            public string LableA(string Content, string ClassName, string Href)
            {
                return string.Format(BasicsCode("a", AttributeCode("class", ClassName) + AttributeCode("href", ClassName)), Content);
            }
            /// <summary>
            /// 创建H标签 可设置参数1-6
            /// </summary>
            /// <param name="Content"></param>
            /// <param name="HLableCount"></param>
            /// <returns></returns>
            public string LableH(string Content, int HLableCount)
            {
                return string.Format(BasicsCode("h" + HLableCount), Content);
            }

            /// <summary>
            /// 创建H标签 可设置参数1-6
            /// </summary>
            /// <param name="Content"></param>
            /// <param name="HLableCount"></param>
            /// <returns></returns>
            public string LableH(string Content, int HLableCount, string ClassName)
            {
                return string.Format(BasicsCode("h" + HLableCount, AttributeCode("class", ClassName)), Content);
            }

            public string LableStrong(string Content)
            {

                return string.Format(BasicsCode("strong"), Content);
            }

            public string LableStrong(string Content, string ClassName)
            {
                return string.Format(BasicsCode("strong", AttributeCode("class", ClassName)), Content);
            }
        }
    }
}
